<template>
<div>
  <div v-if="message.type !== 'transfer'" style="position: relative">
    <div class="el-message-box__status el-icon-warning"></div><div class="el-message-box__message" style="margin-left: 50px"><p>{{message.content}}</p></div>
  </div>
  <el-form label-position="top"  ref="form" :model="form" class="" v-else>
    <el-form-item :label="$t('configLazyLoad.robotSeven.questionType')">
      <el-select size="mini"  v-model.trim="form.value" style="width:100%">
        <el-option v-for="(item, index) in message.content" :label="item.name" :value="item._id" v-if="item.pId">
        </el-option>
      </el-select>
    </el-form-item>
  </el-form>
  <div class="btn">
    <el-button class="primary_btn" @click="close">{{$t('public.cancel')}}</el-button>
    <el-button class="primary_btn" :type="message.type === 'delete'? 'danger':'primary'" @click="confirm">{{message.type === 'delete'? $t('public.delete'):$t('public.confirm')}}</el-button>
  </div>
</div>
</template>
<script>
  export default {
    name: 'operate',
    data () {
      return {
        form: {
          value: ''
        }
      }
    },
    props: {
      message: Object
    },
    components: {
    },
    methods: {
      confirm () {
        if (this.message.type === 'transfer') {
          if (!this.form.value) {
            this.$message.error(this.$t('configLazyLoad.robotSeven.errorMessage'))
            return
          }
          this.$emit('confirm', this.form.value)
        } else {
          this.$emit('confirm')
        }
      },
      close () {
        this.$emit('close')
      }
    },
    beforeMount () {
    }
  }
</script>
<style lang="stylus" scoped>
  @import "../../../../../assets/common.styl"
  .btn
    text-align: center
    padding-top 20px
</style>
